execute as @e[tag=mt_gen] run scoreboard players operation @s mt_index -= rendered mt_index
execute as @e[scores={mt_index=0},tag=mt_gen] run tag @s add mt_surf_fill_in2
execute as @e[scores={mt_index=1},tag=mt_gen] run tag @s add mt_surf_fill_in3
execute as @e[tag=mt_gen] run scoreboard players operation @s mt_index += rendered mt_index

execute if score rendered mt_index = init_loop_const mt_index as @e[scores={mt_index=0},tag=mt_gen] run tag @s add mt_surf_fill_in3

tag @e[limit=1,tag=mt_center] add mt_surf_fill_in1
# say in1: @e[tag=mt_surf_fill_in1] in2: @e[tag=mt_surf_fill_in2] in3: @e[tag=mt_surf_fill_in3]

function mountain:surf_fill/entry
tag @e[tag=mt_surf_fill_in2] remove mt_surf_fill_in2
tag @e[tag=mt_surf_fill_in3] remove mt_surf_fill_in3
tag @e[tag=mt_surf_fill_in1] remove mt_surf_fill_in1

scoreboard players add rendered mt_index 1

execute if score rendered mt_index < init_max mt_index run schedule function mountain:gen/init/fill_loop 1s

# 计分板设置上一层的数量
execute if score rendered mt_index = init_max mt_index run scoreboard players set last_cnt mt_index 3
execute if score rendered mt_index = init_max mt_index run schedule function mountain:gen/gen_next 1s